package com.hup.minicontroller.common.constant;

/**
 * UDP广播常量
 *
 * @author hugan
 * @date 2021/5/10
 */
public abstract class BroadcastConstant {

    /**
     * 端口号
     */
    public static final int PORT = 38678;
    /**
     * ip端,不是随意改的;
     * https://blog.csdn.net/jyqqhw_41/article/details/49704167
     */
    public static final String IP = "230.0.0.1";

    /**
     * 服务端发送广播的间隔,单位-毫秒
     */
    public static final int SERVER_SEND_SPAN = 3000;
    /**
     * 客户端socket接收超时;
     * .用于java.net.DatagramSocket#setSoTimeout(int)
     * .必须设置值,不然socket会一直阻塞等待
     * .值必须大于SERVER_SEND_SPAN,不然接收时很容易超时
     */
    public static final int CLIENT_RECEIVE_TIMEOUT = SERVER_SEND_SPAN + 500;

    /**
     * 服务端发送的消息的前缀,用于区别和过滤非本app的消息
     */
    public static final String MSG_HEAD = "5ub8吗m2lkZ";

    /**
     * 服务端发送消息的最大长度,用于区别和过滤非本app的消息
     */
    public static final int MAX_MSG_LENGTH = MSG_HEAD.getBytes().length + 15;

}
